<template>
  <b-scroll id="tab-menu">
    <div class="menu-list-item"
         v-for="(item, index) in categories"
         :class="{active : index===currentIndex}"
         :key = "index"
         @click="itemClick(index)">
      {{item.title}}
    </div>
  </b-scroll>
</template>

<script>
  import BScroll from "components/common/bscroll/BScroll";

  export default {
    name: "TabMenu",
    data(){
      return{
        currentIndex:0
      }
    },
    components:{
      BScroll
    },
    props:{
      categories:{
        type:Array,
        default(){
          return []
        }
      }
    },
    methods:{
      itemClick(index){
        this.currentIndex = index
        this.$emit('selectItem', index)
      }
    }

  }
</script>

<style scoped>
  #tab-menu {
    background-color: #f6f6f6;
    height: 100%;
    width: 100px;
    box-sizing: border-box;
  }

  .menu-list-item {
    height: 45px;
    line-height: 45px;
    text-align: center;
    font-size: 14px;
  }

  .menu-list-item.active {
    font-weight: 700;
    color: var(--color-high-text);
    background-color: #fff;
    border-left: 3px solid var(--color-high-text);
  }
</style>
